package com.lgh.hotel.controller;

import com.lgh.hotel.dao.pojo.Punch;
import com.lgh.hotel.service.PunchService;
import com.lgh.hotel.vo.Result;
import com.lgh.hotel.vo.params.PunchParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "疫情打卡模块")
@RestController
@RequestMapping("punch")
public class PunchController {


    @Autowired
    PunchService punchService;

    @ApiOperation("获取全部疫情打卡信息")
    @GetMapping
    public Result findPunchAll(){
        return punchService.findPunchAll();
    }

    @ApiOperation("提交打卡")
    @PostMapping("/addPunch")
    public Result addPunch(@RequestBody PunchParams params){
        return punchService.addPunch(params);
    }

    @ApiOperation("获取用户打卡数据")
    @GetMapping("/findPunchAllById/{id}")
    public Result findPunchAllById(@PathVariable("id")Long idCrad){
        return punchService.findPunchAllById(idCrad);
    }


    @ApiOperation("获取全部用户打卡情况")
    @GetMapping("/findall")
    public Result findall(){
        return punchService.findall();
    }


    @ApiOperation("打卡审核")
    @GetMapping("/audit")
    public Result audit(){
        return punchService.audit();
    }



    @ApiOperation("更新打卡是否通过")
    @PutMapping("/updateAudit")
    public Result updateAudit(@RequestBody Punch punch){
        return punchService.updateAudit(punch);
    }


    @ApiOperation("获取用户最新打卡 是否通过")
    @GetMapping("/find/pass/{id}")
    public Result findpassid(@PathVariable("id")Long id){
        return punchService.findpassid(id);
    }


}
